<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
  </head>
  <body>
	<h1>首页</h1>
	<div id="head">
		<h1>商务会员管理系统</h1>
		用户名：<s:property value="#session.USERS.name" />
		用户类型：<s:property value="#session.USERS.userType.name" />
		<a href="#">退出</a>
	</div>
	<ul>
		<li><a href="modifyPwd.jsp">修改密码</a></li>
		<li><a href="lookup">查看所有会员</a></li>
	</ul>
	<hr />
	<s:form id="frm" action="lookup">
	<div>
		<h2>会员信息</h2>
		用户名：<s:textfield name="page.cond['name']" ></s:textfield>
		<input type="button" id="btnGo" value="查找" />
		<table >
			<thead>
				<tr>
					<th>序号</th>
					<th>用户名</th>
					<th>用户类别</th>
					<th>用户状态</th>
					<th>最后修改时间</th>
				</tr>
			</thead>
			<tbody>
				<s:if test="page.total == 0">
					<tr>
						<td colspan='8' align='center' style="font-weight:bold">
							抱歉，暂无数据
						</td>
					</tr>
				</s:if>
				<s:iterator value="page.list" status="s">
					<tr>
						<td><s:property value="#s.index + 1" /></td>
						<td>${name}</td>
						<td>${userType.name}</td>
						<td>
							<s:if test="status == 0">
								已冻结
							</s:if>
							<s:else>
								正常
							</s:else>
						</td>
						<td>
							<s:date name="lastModifyTime" format="yyyy-MM-dd"/>
						</td>
					</tr>
				</s:iterator>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="5">
						<a href="javascript:toPage(1)">首页</a>
						<s:a href="javascript:toPage(%{page.prev })">上一页</s:a>
							
						${page.pageNo } / ${page.pageTotal }
						
						<s:a href="javascript:toPage(%{page.next })">下一页</s:a>
						<s:a href="javascript:toPage(%{page.pageTotal })">末页</s:a>
						<s:hidden name="page.pageNo" id="pageNo"></s:hidden>
						共 ${page.total} 条记录  
					</td>
				</tr>
			</tfoot>
		</table>	
	</div>
	</s:form>
	
	<s:debug></s:debug>
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.8.3.js"></script>
	<script type="text/javascript">
		var msg = '<s:property value="actionMessages[0]" />'
		if(msg){
			alert(msg);
		}
		function	toPage(pageNo){
			$('#pageNo').val(pageNo);
			$('#frm').submit();
		}
		$(function(){
			$('#btnGo').click(function(){
				toPage($('#pageNo').val());
			});
			
			$('table thead tr').css('background-color', '#ADD8E6');
			$('table tbody tr:odd').css('background-color', '#90EE90');
		});
		
		function	doDelete(id){
			if(confirm('是否删除本记录？')){
				location = 'delete/' + id;
			}
		}
	</script>
  </body>
  
  
  
  
  
  
  
  
  
  
</html>
